<% /* $Id: problems.jsp 132 2011-08-26 10:23:42Z altdotua@gmail.com $ */ %>

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>

<%@ include file="../header.jsp" %>


<h2>Problems</h2>


<%= (new ProblemsFormatter()).format(ProblemsModel.getAllEntries()) %>

<%
	ProblemEntry problem = ProblemsModel.getEntry(Long.parseLong(request.getParameter("id")));
%>

<h2><%= problem == null ? "Add problem" : "Edit problem \"" + problem + "\"" %></h2>

<form action="<%= Linker.link("problems") %>" method="post">
	<input type="hidden" name="action" value="edit">
	<input type="hidden" name="return" value="<%= request.getRequestURL() %>">
	<input type="hidden" name="id" value="<%= request.getParameter("id") %>">
  <p>SID: <input name="sid" value="<%= null == problem ? "" : problem.getSid() %>"> 
  Name: <input name="name" value="<%= null == problem ? "" : problem.getName() %>"></p>
  <p>TimeLimit: <input name="timeLimit" value="<%= null == problem ? "" : problem.getTimeLimit() %>">, 
  MemoryLimit: <input name="memoryLimit" value="<%= null == problem ? "" : problem.getMemoryLimit() %>"></p>
  <p>DJudge contest: <input name="djudgeContest" value="<%= null == problem ? "" : problem.getDjudgeContest() %>">, 
  problem: <input name="djudgeProblem" value="<%= null == problem ? "" : problem.getDjudgeProblem() %>"></p>
  <p><input type="checkbox" name="active" <%= null == problem || problem.getActive() ? "checked='checked'" : "" %>>Доступна?</p>
  <p><textarea name="statement" style="width:100%"><%= null == problem ? "" : StringEscapeUtils.escapeHtml(problem.getStatement()) %></textarea></p>
  <p><input type="submit" value="Submit"></p>
</form>
<br>

<%@include file="../footer.jsp"%>
